//
//  PromotionCell.m
//  TT
//
//  Created by Lenny on 16/4/19.
//  Copyright © 2016年 Lenny. All rights reserved.
//

#import "PromotionCell.h"

@interface PromotionCell ()

@property(nonatomic,strong)UIButton *btn;

@end

@implementation PromotionCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = [UIColor yellowColor];
        [self UI];
    }
    return self;
}

#pragma mark - event motheds 
- (void)btnAction:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(cellProtocol:withDic:)]) {
        
        [self.delegate cellProtocol:self withDic:nil];
    }
}

#pragma mark - private methods 
- (void)UI {
    
    [self addSubview:self.btn];
    
    __weak typeof(self) weakSelf = self;
    [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
        make.width.equalTo(weakSelf.mas_height);
    }];
}

#pragma mark - setters and getters

- (UIButton *)btn {
    
    if (_btn == nil) {
        
        _btn= [[UIButton alloc] init];
        _btn.backgroundColor = [UIColor colorWithHexColor:@"fff8db"];
        [_btn setTitle:@"点击\n领取" forState:UIControlStateNormal];
        [_btn setTitleColor:WL_Top_Color forState:UIControlStateNormal];
        _btn.titleLabel.numberOfLines = 0;
        _btn.titleLabel.font = [UIFont systemFontOfSize:13];
        [_btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _btn;
}

@end
